package com.github.serezhka.airplay.player.gstreamer;

import com.csmk.control.MKSApi;
import lombok.extern.slf4j.Slf4j;

import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;

@Slf4j
public class GstMouseListener implements MouseListener {
    private final MKSApi mksApi;


    public GstMouseListener(MKSApi mksApi) {
        this.mksApi = mksApi;
    }

    @Override
    public void mouseClicked(MouseEvent e) {

        // 鼠标右键
        if(e.getButton() == MouseEvent.BUTTON3){
            // 右键一次返回桌面 右键两次调出任务栏
            log.info("打开任务栏");
            mksApi.switcher();
        }else if(e.getButton() == MouseEvent.BUTTON2){
            log.info("返回主页");
            mksApi.home();
        }

    }

    @Override
    public void mousePressed(MouseEvent e) {
        if(e.getButton() == MouseEvent.BUTTON1){
            mksApi.touchDown(e.getX(),e.getY());
        }
    }

    @Override
    public void mouseReleased(MouseEvent e) {
        if(e.getButton() == MouseEvent.BUTTON1){
            mksApi.touchUp(e.getX(), e.getY());
        }
    }

    @Override
    public void mouseEntered(MouseEvent e) {

    }

    @Override
    public void mouseExited(MouseEvent e) {

    }
}
